/*
 * 文件名: TransactionListByCalendarNaviDialog.java
 * 版    权：  Copyright PingAn Technology All Rights Reserved.
 * 描    述: [该类的简要描述]
 * 创建人: EX-XIAOFANQING001
 * 创建时间: 2012-4-6
 * 
 * 修改人：
 * 修改时间:
 * 修改内容：[修改内容]
 */
package app.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.Window;
import android.widget.LinearLayout.LayoutParams;
import app.struct.AppKeyConstants;
import app.utils.CommonUtils;


/**
 * 导航的Dialog
 * @author EX-XIAOFANQING001
 * @date 2012-4-6
 * @version [Android PABank C01, @2012-4-6]
 * @description
 */
public class GuideDialog extends Dialog
{
    
    private String navType;
    
    /**
     * 构造器
     * @param context 上下文
     * @param navType 可选值 
     * {@link AppKeyConstants#SHARED_HOME_FIRST_LAUNCHER}  
     * {@link AppKeyConstants#SHARED_CALANDER_FIRST_LAUNCHER}
     * {@link AppKeyConstants#SHARED_TRANSFER_FIRST_LAUNCHER}  
     * {@link AppKeyConstants#SHARED_MY_SELF_FIRST_LAUNCHER}
     */
    public GuideDialog(Context context, String navType) {
        super(context);
        this.navType = navType;
        init();
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    }

    private void init() {
        this.getContext().setTheme(android.R.style.Theme_Translucent_NoTitleBar);
        Window window  = getWindow();
        window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); 
    }

    @Override
    public void dismiss()
    {
        super.dismiss();
        CommonUtils.cancleNavigation(getContext(), navType);
    }

    @Override
    public void cancel()
    {
        super.cancel();
        CommonUtils.cancleNavigation(getContext(), navType);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event)
    {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            cancel();
        }
        return super.onTouchEvent(event);
    }
}

